<div class="row2" >
    <div class="">
        <h1>
            <small>
                <i class="fi-torsos-all" style="font-size: 35px; padding-right: 10px; margin-left: 5px;"></i><span style="vertical-align: 6px;">Consulta de Tipos de CND</span>  
            </small>
        </h1>
    </div>   


    <table width="100%"  class="table table-bordered table-hover" border="1px" cellspacing="0" cellpadding="0">
        <thead>
            <tr>
                <td width="60%" bgcolor="#f0f0f0">
                    <center>Tipo Cnd</center>
                </td>
                <td width="15%" bgcolor="#f0f0f0">
                    <center>Âmbito</center>
                </td>
                <td width="15%" colspan="2" bgcolor="#f0f0f0">
                    <center>Ação</center>
                </td>
            </tr>
        </thead>
        <tbody>
            <?php
                $contador = 0;
                foreach ($tipocnds as $tipocnd) {
                    $contador++
                ?>
            <tr>
                <td>
                    <?php echo $tipocnd->tipoCnd_descricao ?>
                </td>
                <td>
                    <?php echo $tipocnd->ambitocnd_descricao ?>
                </td>
                <td style="vertical-align: middle">
                    <center>
                        <a class="medium" style="color: #000; font-size: 25px;" title="Editar" href="<?php echo base_url('index.php/tipocnd?tipocnd_id=' . $tipocnd->tipoCnd_id) ?>"><i class="fi-page-edit"></i></a>
                    </center>
                </td>
                <td style="vertical-align: middle">
                <center>
                    <a class="medium" data-reveal-id="firstModal" style="color: #000; font-size: 25px;" title="Excluir" onclick="selectTipoCnd(<?php echo $tipocnd->tipoCnd_id ?>)"><i class="fi-trash"></i></a>
                </center>
                </td>
            </tr>  
        <?php } ?>

            <tr style="font-weight:bold;" >
                <td bgcolor="#f0f0f0" colspan="5">
                    Quantidade de Tipo de Cnd: <?php echo $contador; ?>
                </td>
            </tr>
        </tbody>
    </table>
    <div id="firstModal" class="reveal-modal tiny" data-reveal>            
        <center><p>Confirma a exclusão deste tipo de CND ?</p> <br></center>
        <center><a id="btExcluir" href="#"> <input type="submit" class="button alert small radius" value="Confirmar" onclick="excluir()"/></a></center>            
        <a class="close-reveal-modal">&#215;</a>
    </div>  
</div>

<script>

    function selectTipoCnd(tipoCnd_id) {
        var caminho = "<?php echo base_url('index.php/tipocnd/excluir?tipocnd_id=') ?>" + tipoCnd_id;
        document.getElementById("btExcluir").href = caminho;
    }

    function excluir() {
        document.formulario.action = "<?php echo base_url('index.php/tipocnd/excluir/') ?>";
        document.formulario.submit();
    }

</script>